@echo off
setlocal enabledelayedexpansion

rem 设置日期时间格式
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do set "dateStamp=%%c-%%a-%%b"
for /f "tokens=1-2 delims=: " %%a in ('time /t') do set "timeStamp=%%a-%%b"

rem 遍历当前目录下的所有txt文件
for %%f in (*.txt) do (
    rem 构建新文件名
    set "newName=!dateStamp!_!timeStamp!_%%f"
    
    rem 重命名文件
    ren "%%f" "!newName!"
    
    echo 文件 "%%f" 重命名为 "!newName!"
)

endlocal
